# -*- coding: utf-8 -*-
from config.default import *

DEBUG = True

# 数据库设置
DATABASES.update({
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': APP_CODE,
        'HOST': '127.0.0.1',
        'USER': 'root',
        'PASSWORD': 'Root1234',
        'PORT': '3306',
        # 'OPTIONS': { 'init_command': 'SET storage_engine=INNODB;' }
    }
})

#  Celery 消息队列设置 RabbitMQ
# BROKER_URL = 'amqp://guest:guest@localhost:5672//'
# CELERY_RESULT_BACKEND = 'amqp://guest:guest@localhost:5672//'
BROKER_URL = 'redis://localhost:6379/1'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/2'

#BROKER_URL = 'amqp://hannoch:hannoch@172.20.192.1:5672//'
# CELERY_RESULT_BACKEND = 'amqp://hannoch:hannoch@172.20.192.1:5672//'

ASGI_APPLICATION = 'domain_redirect.routing.application'#
# 【channels】后端
if IS_USE_CHANNEL:
    CHANNEL_LAYERS = {
        "default": {
            "BACKEND": "channels_redis.core.RedisChannelLayer",
            "CONFIG": {
                "hosts": [("localhost", 6379)],
                'capacity': 1500,
                'expiry': 5,
            },
        },
    }
# request 请求使用代理
IS_USE_REQUEST_PROXY = True

# redis 配置
REDIS_HOST = 'localhost'
REDIS_PORT = 6379

# 开启日志
IS_USE_LOGGER = os.environ.get('IS_USE_LOGGER', True)
if not IS_USE_LOGGER:
    LOGGING = {}